import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        name: '入口',
        path: '/',
        redirect: "/frontState"
    },
    {
        name: '前台',
        path: '/frontState',
        redirect: "/frontState/homePage",
        component: () => import("/src/views/FrontState/FrontMain.vue"),
        children: [
            {
                name: "前台-首页",
                path: '/frontState/homePage',
                component: () => import("/src/views/FrontState/main/homePage.vue")
            },
            {
                name: "前台-场地预订",
                path: '/frontState/rent',
                component: () => import("/src/views/FrontState/main/selectCourt.vue")
            },
            {
                name: "前台-场地列表",
                path: '/frontState/courtList',
                component: () => import("/src/views/FrontState/main/courtList.vue")
            },
            {
                name: "前台-忘记密码",
                path: '/frontState/forgetPassword',
                component: () => import("/src/views/FrontState/main/forgetPassword.vue")
            },
            {
                name: "前台-关于我们",
                path: '/frontState/aboutUs',
                component: () => import("/src/views/FrontState/main/aboutUs.vue")
            },
            {
                name: "前台-网站信息",
                path: '/frontState/webMessage',
                component: () => import("/src/views/FrontState/main/webMessage.vue")
            }
        ]
    },
    {
        name: "个人主页",
        path: "/background",
        component: () => import("/src/views/FrontState/userBackground/backgroundMain.vue"),
        children: [
            {
                name: "个人主页-我的信息",
                path: '/background/message',
                component: () => import("/src/views/FrontState/userBackground/myMessage.vue")
            },
            {
                name: "个人主页-密码修改",
                path: '/background/passwordUpdate',
                component: () => import("/src/views/FrontState/userBackground/passwordUpdate.vue")
            },
            {
                name: "个人主页-头像修改",
                path: '/background/iconUpdate',
                component: () => import("/src/views/FrontState/userBackground/iconUpdate.vue")
            },
            {
                name: "个人主页-订单列表",
                path: '/background/orderList',
                component: () => import("/src/views/FrontState/userBackground/userOrder.vue")
            },
        ]
    },
    {
        name: '后台-登录',
        path: '/backState/login',
        component: () => import("/src/views/backState/login.vue")
    },
    {
        name: '后台-主页',
        path: '/backState/adminHome',
        component: () => import("/src/views/backState/adminHome.vue"),
        children: [
            {
                name: '后台-订单管理-订单(1-1)',
                path: '/backState/adminHome/order',
                component: () => import("/src/views/backState/order/orderMain.vue")
            },
            {
                name: '后台-场地管理-类别(2-1)',
                path: '/backState/adminHome/site/category',
                component: () => import("/src/views/backState/site/category/categoryMain.vue")
            },
            {
                name: '后台-场地管理-场地(2-2)',
                path: '/backState/adminHome/site/court',
                component: () => import("/src/views/backState/site/court/courtMain.vue")
            },
            {
                name: '后台-场地管理-相册(2-3)',
                path: '/backState/adminHome/site/album',
                component: () => import("/src/views/backState/site/album/albumMain.vue")
            },

            {
                name: '后台-用户管理-用户(3-1)',
                path: '/backState/adminHome/customer/users',
                component: () => import("/src/views/backState/customer/users/usersMain.vue")
            },
            {
                name: "后台-后台人员管理-管理员(4-1)",
                path: '/backState/adminHome/staff/admin',
                component: () => import("/src/views/backState/staff/admin/adminMain.vue"),
            },
            {
                name: "后台-后台人员管理-角色(4-2)",
                path: '/backState/adminHome/staff/role',
                component: () => import("/src/views/backState/staff/role/roleMain.vue"),
            },
            {
                name: "后台-后台人员管理-权限(4-3)",
                path: '/backState/adminHome/staff/permission',
                component: () => import("/src/views/backState/staff/permission/permissionMain.vue")
            }
        ]
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
